package com.ee.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import com.ee.bean.Equipment;
import com.ee.bean.User;
import com.ee.bean.Workflow;
import com.ee.dao.WorkflowDao;
import com.ee.service.WorkflowService;
@Component("workflowService")
public class WorkflowServiceImpl implements WorkflowService{

	private WorkflowDao workflowDao;
	
	@Override
	public void add(Workflow workflow) {
		workflowDao.saveWorkflow(workflow);
	}

	@Override
	public void update(Workflow workflow) {
		workflowDao.update(workflow);
	}

	@Override
	public void delete(Workflow workflow) {
		workflowDao.deleteWorkflow(workflow);
	}

	@Override
	public List<Workflow> findAllWorkflows() {
		return workflowDao.findAllWorkflows();
	}

	@Override
	public List<Workflow> findWorkflowsByUser(User user) {
		return workflowDao.findAllWorkflowsByUser(user);
	}

	@Override
	public Workflow findWorkflowByEquipment(Equipment equipment) {
		return null;
	}

	public WorkflowDao getWorkflowDao() {
		return workflowDao;
	}
	@Resource
	public void setWorkflowDao(WorkflowDao workflowDao) {
		this.workflowDao = workflowDao;
	}

	@Override
	public Workflow findWorkflowById(int id) {
		return workflowDao.findWorkflowById(id);
	}

}
